﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Windows.Media.Imaging;
using STEditor.Classes;
using System.IO;

namespace STEditor.Classes.Tests
{
    [TestClass]
    public class STFrameTests
    {
        [TestMethod]
        public void STFrame_Should_Derive_From_BitmapImage()
        {

            var frame = new STFrame();

            Assert.IsInstanceOfType(frame, typeof(BitmapSource), "STFrame does not derive from BitmapSource");

        }

        [TestMethod]
        public void STFrame_Should_Have_Source_Property()
        {

            var frame = new STFrame();
            var uri = new Uri("file://C:/Users/Rune/Documents/Visual Studio 2010/Projects/SilverTileApp/Assets/STEditor/STEditor.Classes.Tests/Images/Tile.png");

            frame.Source = uri;
            Assert.AreSame(uri, frame.Source, "Source was not set correctly");

        }

        [TestMethod]
        public void Setting_Source_Should_Cause_STFrame_To_Load_Image()
        {

            var frame = new STFrame();

            var location = Path.GetDirectoryName(this.GetType().Assembly.Location);
            location = Path.Combine(location, @"Images/Tile.png");
                        
            frame.Source = new Uri(location);

            Assert.AreEqual(32, (int)frame.Width, "Width was not set correctly");
            Assert.AreEqual(32, (int)frame.Height, "Height was not set correctly");
            
        }

    }
}
